﻿using UnityEngine;
using System.Collections;

public class Dummie : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	public void comenzarAnimacion(float x, float y , float z ){
		StartCoroutine(animacionRobar(x,y,z));
	}
	IEnumerator animacionRobar( float x, float y , float z ){
		float distx = x-gameObject.transform.position.x;
		float disty = y-gameObject.transform.position.y;
		float distz = z-gameObject.transform.position.z;
		
		for(int i =0 ; i <50 ;  i++){
			yield return new WaitForSeconds (0.005f);
			gameObject.transform.position = new Vector3 (gameObject.transform.position.x + (distx/50),gameObject.transform.position.y + (disty/50),gameObject.transform.position.z + (distz/50));
			
		}
	}
}
